<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>embedme: libemb::TcpServer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">embedme
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>libemb</b></li><li class="navelem"><a class="el" href="classlibemb_1_1_tcp_server.html">TcpServer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classlibemb_1_1_tcp_server-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">libemb::TcpServer Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>Tcp服务器  
 <a href="classlibemb_1_1_tcp_server.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_socket_8h_source.html">Socket.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for libemb::TcpServer:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classlibemb_1_1_tcp_server.png" usemap="#libemb::TcpServer_map" alt=""/>
  <map id="libemb::TcpServer_map" name="libemb::TcpServer_map">
<area href="classlibemb_1_1_runnable.html" title="线程运行体,子类必须重写run方法." alt="libemb::Runnable" shape="rect" coords="0,0,145,24"/>
<area href="classlibemb_1_1_local_tcp_server.html" title="本地TCP服务器" alt="libemb::LocalTcpServer" shape="rect" coords="0,112,145,136"/>
  </map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aa221792db3671ea0d0ed7f2e4ac6dc24"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_tcp_server.html#aa221792db3671ea0d0ed7f2e4ac6dc24">setup</a> (std::string serverIP, <a class="el" href="_base_type_8h.html#aebf3b8d3c22313714b07d595cc3effac">uint16</a> serverPort, int maxPendings=1)</td></tr>
<tr class="memdesc:aa221792db3671ea0d0ed7f2e4ac6dc24"><td class="mdescLeft">&#160;</td><td class="mdescRight">服务配置  <a href="classlibemb_1_1_tcp_server.html#aa221792db3671ea0d0ed7f2e4ac6dc24">More...</a><br /></td></tr>
<tr class="separator:aa221792db3671ea0d0ed7f2e4ac6dc24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a753689163dc824f7458c3cd3eb2dd622"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_tcp_server.html#a753689163dc824f7458c3cd3eb2dd622">onNewConnection</a> (std::unique_ptr&lt; <a class="el" href="classlibemb_1_1_tcp_socket.html">TcpSocket</a> &gt; client)=0</td></tr>
<tr class="memdesc:a753689163dc824f7458c3cd3eb2dd622"><td class="mdescLeft">&#160;</td><td class="mdescRight">TCP连接回调方法  <a href="classlibemb_1_1_tcp_server.html#a753689163dc824f7458c3cd3eb2dd622">More...</a><br /></td></tr>
<tr class="separator:a753689163dc824f7458c3cd3eb2dd622"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:ae1ffad1a5efc896186c0d1fa52da482d"><td class="memItemLeft" align="right" valign="top"><a id="ae1ffad1a5efc896186c0d1fa52da482d"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>m_stopFlag</b> {false}</td></tr>
<tr class="separator:ae1ffad1a5efc896186c0d1fa52da482d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a593e2b04f4a91c0e2a8dd04c44723247"><td class="memItemLeft" align="right" valign="top"><a id="a593e2b04f4a91c0e2a8dd04c44723247"></a>
std::unique_ptr&lt; <a class="el" href="classlibemb_1_1_tcp_socket.html">TcpSocket</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>m_serverSocket</b></td></tr>
<tr class="separator:a593e2b04f4a91c0e2a8dd04c44723247"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Tcp服务器 </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a753689163dc824f7458c3cd3eb2dd622"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a753689163dc824f7458c3cd3eb2dd622">&#9670;&nbsp;</a></span>onNewConnection()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool libemb::TcpServer::onNewConnection </td>
          <td>(</td>
          <td class="paramtype">std::unique_ptr&lt; <a class="el" href="classlibemb_1_1_tcp_socket.html">TcpSocket</a> &gt;&#160;</td>
          <td class="paramname"><em>client</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>TCP连接回调方法 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">client</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true 继续处理流 </dd>
<dd>
false 退出服务 </dd></dl>

</div>
</div>
<a id="aa221792db3671ea0d0ed7f2e4ac6dc24"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa221792db3671ea0d0ed7f2e4ac6dc24">&#9670;&nbsp;</a></span>setup()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool libemb::TcpServer::setup </td>
          <td>(</td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>serverIP</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="_base_type_8h.html#aebf3b8d3c22313714b07d595cc3effac">uint16</a>&#160;</td>
          <td class="paramname"><em>serverPort</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>maxPendings</em> = <code>1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>服务配置 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">serverIP</td><td></td></tr>
    <tr><td class="paramname">serverPort</td><td></td></tr>
    <tr><td class="paramname">maxPendings</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true </dd>
<dd>
false </dd></dl>

<p>Reimplemented in <a class="el" href="classlibemb_1_1_local_tcp_server.html#a12b9aed57b22af9959b34cd489e80369">libemb::LocalTcpServer</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="_socket_8h_source.html">Socket.h</a></li>
<li>src/Socket.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>
